
	/* Do-file for replication of Main-text analysis for 

	War, Solidarity, and Welfare Attitudes:
	Survey Evidence from the War in Ukraine
	
By Frizell, Jakob, Viktoriia Muliavka, Herbert Obinger, and Carina Schmitt

	(2025) Journal of European Public Policy

	
	
Output produced with Stata 17. 

User-written commands utilized: 
 - spmap
	Pisati, M. (2018). "SPMAP: Stata module to visualize spatial data"
- coefplot
	 Jann, B. (2013). coefplot: Stata module to plot regression coefficients and other results.

ssc install spmap
ssc install coefplot


*/



*Set directory to main folder
	* cd "...\Supplementary Material" *

*** Figure 1 & 2 - Mapping war exposure and financial impact

*Load main data file
use "Ukraine_warwel_survey_2023_red_noid.dta", clear
*First averaging relevant variables on (post-invasion) Oblast
collapse (mean) fat20gtwlnnorm B1invnorm, by(postA1)

gen ADM1_EN=postA1
replace ADM1_EN="Kyiv" if ADM1_EN=="Kyiv City"
replace ADM1_EN="Mykolaivska" if ADM1_EN=="Mykolayivska"

merge 1:1 ADM1_EN using "GEO\UKR1db.dta"
*Since we lack respondents from Crimea, Luhans and Sevastopol, these remain
	*unmerged
drop _merge

*Save dataset containing the relevant data along with Oblast identifiers
save "GEO\UKR1db_IV.dta", replace



** Load and label data for Ukrainian macro-regions
use "GEO\UKRREGdb.dta", clear
gen x_adj=x_centr
gen y_adj=y_centr


replace x_adj=x_centr-0.8 if REG=="West"
replace y_adj=y_centr+0.1 if REG=="West"

replace x_adj=x_centr-0.4 if REG=="Center"
replace y_adj=y_centr+0.1 if REG=="Center"

replace x_adj=x_centr-0.2 if REG=="East"
replace y_adj=y_centr+0.5 if REG=="East"

replace x_adj=x_centr+0.3 if REG=="South"
replace y_adj=y_centr-0.1 if REG=="South"

save "GEO\UKRREGdb_lab.dta", replace 


**** Plotting Maps ****

use "GEO\UKR1db_IV.dta", clear


			****** FIGURE 1. War exposure, province (Oblast) averages ****
			
			
			
*New rounded fatalities variable	
gen fat_round=round(fat20gtwlnnorm, 0.01)

	 spmap fat_round using "GEO\UKR1coord_wmproj.dta", id(id) ndsize(0.1) ///
	 ndfcolor(white) ndocolor(black) ndlab("No respondents") ///
	 osize(0.1 ..) fcolor(Heat) clm(c) clbreaks(0.0(0.1)1) legstyle(3) ///
	 title("") ///
	  label(d("GEO\UKRREGdb_lab.dta") l(REG) x(x_adj) y(y_adj) size(large)) ///
	 polygon(dat("GEO\UKRREGcoord_wmproj.dta") osize(0.4))
	 
	 graph export "Main output\Fig_1_War exp by oblast.jpg", width(5000) replace
	 
	
	
			****** FIGURE 2. Financial impact, province (Oblast) averages ****
	
*New rounded variable
gen B1_round=round(B1invnorm, 0.01)
	
	 	 spmap B1_round using "GEO\UKR1coord_wmproj.dta", id(id) ndsize(0.1) ///
		 ndfcolor(white) ndlab("No respondents") ///
	 osize(0.1 ..) fcolor(Heat) clm(c) clbreaks(0(0.1)1) legstyle(3) ///
	 title("") ///
	  label(d("GEO\UKRREGdb_lab.dta") l(REG) x(x_adj) y(y_adj) size(large)) ///
	 polygon(dat("GEO\UKRREGcoord_wmproj.dta") osize(0.4)) 
	 
	 graph export "Main output\Fig_2_Financial impact by oblast.jpg", width(5000) replace
	 
	 
	 
	 
	 *************** //// FIGURES 3-5: DV Distributions \\\\ ****************
	
	
	
	use "Ukraine_warwel_survey_2023_red_noid.dta", clear
	 
	 

	**** Figure 3: Distribution of social policy expenditure variable
	summarize relsocprio if mov==0

	twoway histogram relsocprio if mov==0, percent fcolor(yellow%60) lwidth(0.5pt) ///
	ylab(0(5)20, angle(0) labsize(7.5pt)) ytick(0(2.5)20, noticks grid glwidth(0.5pt)) ///
	xlab(-4(2)6, labsize(7.5pt) grid glwidth(0.5pt)) ///
	xline(0.9175, lpattern(shortdash)) text(18.5 2 "Mean = 0.92", place(3) size(9pt)) ///
	plotregion(margin(b=0) lcolor(none)) graphregion(margin(l=5 r=5)) ///
	ytitle("Percentage", size(9pt)) ///
	xtitle("Relative priority given to social policy expenditure", margin(medsmall) size(9pt))
	
	graph export "Main output\Fig_3_Histogram_Social policy variable.jpg", width(5000) replace
	
	
	

	**** Figure 4: Distribution of National solidarity variable
	summarize relnatalt if mov==0
	
	twoway histogram relnatalt if mov==0, percent fcolor(orange%60) lwidth(0.5pt) ///
	ylab(0(10)50, angle(0) labsize(7.5pt)) ytick(0(10)50, noticks grid glwidth(0.5pt)) ///
	xlab(-4(2)6, labsize(7.5pt) grid glwidth(0.5pt)) ///
	xline(0.3113, lpattern(shortdash)) text(43 2 "Mean = 0.31", place(3) size(9pt)) ///
	plotregion(margin(b=0) lcolor(none)) graphregion(margin(l=5 r=5)) ///
	ytitle("Percentage", size(9pt)) ///
	xtitle("Relative national solidarity", margin(medsmall) size(9pt))
	
	graph export "Main output\Fig_4_Histogram_National soldiarity.jpg", width(5000) replace
	
	
	
	**** Figure 5: Distribution of Fairness demand variable
	summarize C1C if mov==0
	
	twoway histogram C1C if mov==0, discrete percent fcolor(red%70) lwidth(0.5pt) ///
	ylab(0(10)50, angle(0) labsize(7.5pt)) ytick(0(10)50, noticks grid glwidth(0.5pt)) ///
	xlab(0(2)10, labsize(7.5pt) grid glwidth(0.5pt)) ///
	xline(8.204, lpattern(shortdash)) text(43 6 "Mean = 8.20", place(3) size(9pt)) ///
	plotregion(margin(b=0) lcolor(none)) graphregion(margin(l=5 r=5)) ///
	ytitle("Percentage", size(9pt)) ///
	xtitle("Government should ensure fair distribution of war costs", margin(medsmall) size(9pt))
	
	graph export "Main output\Fig_5_Histogram_Fairness demand.jpg", width(5000) replace
	
		
	
	
	
	

********************************************************************************
********************************************************************************

	/////////////  			MAIN REGRESSIONS 			\\\\\\\\\\\\\\					

********************************************************************************
********************************************************************************

use "Ukraine_warwel_survey_2023_red_noid.dta", clear





 
 * Saving estimates of OLS and logit regressions, with baseline controls

 

								*** OLS regressions ****
	*1) Social Policy Priority
			*(A) War Exposure
regress relsocprio fat20gtwlnnorm i.gender i.AgeGr6 i.edu3 incGr if mov==0, vce(cl ADM4nom)
estimates store WE_socprio
			*(B) Financial Impact
 regress relsocprio B1invnorm i.gender i.AgeGr6 i.edu3 incGr if mov==0
 estimates store FI_socprio

	*2) National Solidarity
		*(A) War Exposure
 regress relnatalt fat20gtwlnnorm i.gender i.AgeGr6 i.edu3 incGr if mov==0, vce(cl ADM4nom)
 estimates store WE_natsol
		*(B) Financial Impact
 regress relnatalt B1invnorm i.gender i.AgeGr6 i.edu3 incGr if mov==0
estimates store FI_natsol

	*3) Fairness demand
		*(A) War Exposure
 regress C1C fat20gtwlnnorm i.gender i.AgeGr6 i.edu3 incGr if mov==0, vce(cl ADM4nom)
 estimates store WE_fair
		*(B) Financial Impact
 regress C1C B1invnorm i.gender i.AgeGr6 i.edu3 incGr if mov==0
estimates store FI_fair


					*** Logit regressions ****
   
	*Dichotomizing variables
   sum relsocprio, det
   * Median = 0.777
   gen relsocprio_dum=1 if relsocprio>0.777777 & relsocprio!=.
replace relsocprio_dum=0 if relsocprio_dum==. & relsocprio!=.
   
   sum relnatalt, det
   * Median = 0
   gen relnatalt_dum=1 if relnatalt>0 & relnatalt!=.
replace relnatalt_dum=0 if relnatalt_dum==. & relnatalt!=.

   gen C1C_dum=1 if C1C==10
replace C1C_dum=0 if C1C!=. & C1C!=10
   
   
	*1) Social Policy Priority
			*(A) War Exposure
    logit relsocprio_dum fat20gtwlnnorm i.gender i.AgeGr6 i.edu3 ///
 incGr if mov==0, vce(cl ADM4nom)
 estimates store WE_socprio_lgt
			*(B) Financial Impact
 logit relsocprio_dum B1invnorm i.gender i.AgeGr6 i.edu3 incGr if mov==0
 estimates store FI_socprio_lgt

	*2) National Solidarity
		*(A) War Exposure
 logit relnatalt_dum fat20gtwlnnorm i.gender i.AgeGr6 i.edu3 ///
 incGr if mov==0, vce(cl ADM4nom)
  estimates store WE_natsol_lgt
		*(B) Financial Impact
 logit relnatalt_dum B1invnorm i.gender i.AgeGr6 i.edu3 incGr if mov==0
estimates store FI_natsol_lgt

	*3) Fairness demand
		*(A) War Exposure
logit C1C_dum fat20gtwlnnorm i.gender i.AgeGr6 i.edu3 ///
 incGr if mov==0, vce(cl ADM4nom)
 estimates store WE_fair_lgt
		*(B) Financial Impact
 logit C1C_dum B1invnorm i.gender i.AgeGr6 i.edu3 incGr if mov==0
 estimates store FI_fair_lgt
   
    
 **********************  FIGURE 6:  ************************
 
	*Plotting coefficients with coefplot, based on stored estimates
   
     
 coefplot (WE_socprio FI_socprio, label("OLS (baseline)") ///
			mcolor(black) ciopts(lc(black)) ) ///
		(WE_socprio_lgt FI_socprio_lgt, label("Logit (alternative)") ///
		msym(D) mcolor(gs12) ciopts(lc(gs12))), bylabel("Social expenditure priority") ///
	 || (WE_natsol FI_natsol) (WE_natsol_lgt FI_natsol_lgt), bylab("Relative national solidarity") ///
	 || (WE_fair FI_fair) (WE_fair_lgt FI_fair_lgt), bylab("Fairness demand") ///
	 xline(0, lpattern(shortdash)) keep(fat20gtwlnnorm B1invnorm) ///
 rename(fat20gtwlnnorm = "War exposure" B1invnorm = "Financial impact") ///
 grid(none) msymbol(D) ciopts(lc(black black)) msize(small)  levels(95) ///
 byopts(col(1) compact) xlab(-1(0.5)2, grid glpattern(shortdash) glcolor(gs14) ///
 glwidth(vthin) labsize(small) format(%2.1f)) legend(row(1) size(small)) ///
    fxsize(120)
   *Title: Figure 6. War impact, summary of main coefficients
   *Note: Point estimates with 95% confidence intervals. Black diamonds are based on OLS regressions with basic controls, full results of which are presented in models 2 and 5 of tables B1-3. Results shown as gray diamonds are based on equivalent logit models (B5). For full results and details on dependent variable transformations, see appendix. Logit coefficients (gray diamons) reported as log odds.
   
graph export "Main output\Fig_6_Summary main results.jpg", width(5000) replace
 
 
 eststo clear
 
 *End*
 
 
 

 
